using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using System.Data.SqlClient;

public partial class airline_root_user : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        int ret_code=0;
        SqlCommand cmd = new SqlCommand();
        lblError.Text = "";
        try
        {
            cmd.CommandText = "core_add_root_user";
            SqlParameter para = cmd.Parameters.AddWithValue("@airline", txtAIRLINE.Text);
            para = cmd.Parameters.AddWithValue("@pwd1", txtPWD1.Text);
            para = cmd.Parameters.AddWithValue("@pwd2", txtPWD2.Text);
            para = cmd.Parameters.Add("ret_code", SqlDbType.Int);
            para.Direction = ParameterDirection.ReturnValue;
            TinyDAL.Exec(ref cmd);
            ret_code = (int)para.Value;
            if (ret_code == 0)
                lblError.Text = "Done.";
            else
                lblError.Text = ret_code.ToString();
        }
        catch (Exception ex)
        {
            lblError.Text = ex.Message;
        }
    }

    protected void btnSetPwd_Click(object sender, EventArgs e)
    {

    }
    protected void btnSHA1_Click(object sender, EventArgs e)
    {
        txtDes.Text = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtOri.Text, "SHA1");
    }
}
